CCOMPILE=mips-linux-gnu-
INCLUDES 	 = -I./include/ 
X264_LIBS 	 = -L./lib  ./last_x264/x264-snapshot-20180929-2245/libx264.a 
RTMP_LIBS    = ./librtmp/librtmp.a 
#AAC_LIBS	 = ./lib/libfaac.a 


LIBS         =  $(AAC_LIBS) $(X264_LIBS) $(RTMP_LIBS)

COMPILE_OPTS =  $(INCLUDES)  -O2  -g
C 			 =  c
C_COMPILER   =  $(CCOMPILE)gcc
C_FLAGS 	 =  $(COMPILE_OPTS) $(CPPFLAGS) $(CFLAGS)
CPP 		 =  cpp
CPLUSPLUS_COMPILER = $(CCOMPILE)c++
CPLUSPLUS_FLAGS =   $(COMPILE_OPTS) -Wall  $(CPPFLAGS) $(CXXFLAGS)
OBJ 		 =  o
LINK 		 =  $(CCOMPILE)c++ -o
LINK_OPTS    = $(INCLUDE) -lpthread -L./openssl-1.0.2p/  -lssl  -lcrypto  -lrt -g -L./zlib-1.2.11/ -lz -ldl
CONSOLE_LINK_OPTS = $(LINK_OPTS)
LINK_OBJ	 = main.o librtmp_send264.o x264_encoder.o v4l2_device.o

APP = test

.$(C).$(OBJ):
	$(C_COMPILER) -c $(C_FLAGS) $<
.$(CPP).$(OBJ):
	$(CPLUSPLUS_COMPILER) -c $(CPLUSPLUS_FLAGS) $<

$(APP): $(LINK_OBJ)
	$(LINK) $@  $(LINK_OBJ)  $(LIBS) $(CONSOLE_LINK_OPTS)
	
clean:
	-rm -rf *.$(OBJ) $(APP) core *.core *~ *.h264

